package com.example.nonameaa.controller;

import com.example.nonameaa.utils.Alioss;
import com.example.nonameaa.Common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 功能：
 * 作者：lhp
 * 日期：2024/9/29 9:57
 */

@RestController
@RequestMapping("/files")
public class UploadingFiles
{
    @Autowired
    private Alioss alioss;

    @PostMapping("/upload")
    public Result uploadFiles(MultipartFile file) throws Exception {

        String url =alioss.upload(file);
        System.out.println(url);
        return Result.success(url);
    }
}
